var countdown=require('../public/javascripts/countdown'),sdc = require('sdc-clients'),dc_config=require('../config/dc')['poc'],vmapi = new sdc.VMAPI(dc_config.vmapi)
module.exports = {
	view:function(req, res) {
			vmapi.getVm({uuid: req.params.uuid},function(err, vm){
				if (err) {
				console.log(err)
				}
				res.send(vm);
			})
	},
	post:function (req, res, next) {
		var opt={
			billing_id: 'b73385b6-91ca-e15b-b1c9-d19f317cfe2e',
			image_uuid: 'fd2cc906-8938-11e3-beab-4359c665ac99',
			owner_uuid: '7e5f0cd3-5241-601d-d146-9d93c7af0e1b',
			brand: 'bcc',
			server_uuid: '37313233-3137-3643-5534-333931374b54',
			networks: [{primary: true, uuid: '6c24d56f-093a-45e3-97d6-b9fe6cba170b' }]
		}
		vmapi.createVm(opt,function (err, obj) {
			if(err){
				console.log(err)
				if(err.body&&err.body.errors)
					for(var i in err.body.errors)
						console.log(err.body.errors[i])
			}else console.log(obj)
		})
	}
}